let renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

let camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 1, 500);
camera.position.set(0, 0, 50);
let scene = new THREE.Scene();

let material = new THREE.LineBasicMaterial({ color: 0xffffff });
let geometry = new THREE.Geometry();

//  vertices是点的数组
console.log(geometry.vertices instanceof Array);
geometry.vertices.push(new THREE.Vector3(-10, 0, 0));
geometry.vertices.push(new THREE.Vector3(0, 10, 0));
geometry.vertices.push(new THREE.Vector3(10, 0, 0));
geometry.vertices.push(new THREE.Vector3(0, -10, 0));
geometry.vertices.push(new THREE.Vector3(-10,0,0))
// 连点成线
let line = new THREE.Line(geometry, material);

scene.add(line);

// 渲染循环
function render() {
    // 以每秒60次的频率绘制场景
    requestAnimationFrame(render);
    renderer.render(scene, camera);
    line.rotation.x -= 0.1;
}
render()